package com.atguigu.test;

import com.atguigu.bean.Boss;
import com.atguigu.bean.Person;
import com.atguigu.config.MainConfigAutowired;
import com.atguigu.config.MainConfigOfPropertyValues;
import com.atguigu.dao.BookDao;
import com.atguigu.service.BookService;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

public class IOCTest_Autowired {

    AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigOfPropertyValues.class);

    @Test
    public void test01(){
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigAutowired.class);
       // BookService bookService = applicationContext.getBean(BookService.class);
        //System.out.println(bookService);
        //bookService.print();
//        System.out.println(applicationContext.getBean(BookDao.class));

        Boss bean = applicationContext.getBean(Boss.class);
        System.out.println(bean);
        applicationContext.close();
    }

}
